package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 收货地址
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_address`", autoResultMap = true)
public class LyAddress {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @Length(max = 63, message = "收货人名称长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("收货人名称")
    @TableField(value = "`name`")
    private String name;


    @NotNull
    @ApiModelProperty("用户表的用户ID")
    @TableField(value = "`user_id`")
    private Integer userId;


    @NotNull
    @ApiModelProperty("行政区域表的省ID")
    @TableField(value = "`province_id`")
    private Integer provinceId;


    @NotNull
    @ApiModelProperty("行政区域表的市ID")
    @TableField(value = "`city_id`")
    private Integer cityId;


    @NotNull
    @ApiModelProperty("行政区域表的区县ID")
    @TableField(value = "`area_id`")
    private Integer areaId;


    @Length(max = 127, message = "具体收货地址长度不能超过127位")
    @NotEmpty
    @ApiModelProperty("具体收货地址")
    @TableField(value = "`address`")
    private String address;


    @Length(max = 20, message = "手机号码长度不能超过20位")
    @NotEmpty
    @ApiModelProperty("手机号码")
    @TableField(value = "`mobile`")
    private String mobile;


    @NotNull
    @ApiModelProperty("是否默认地址")
    @TableField(value = "`is_default`")
    private Integer isDefault;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;

}
